{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fe7fd547",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(380, 308, 3) (794, 600, 3)\n",
      "(380, 308, 3)\n"
     ]
    }
   ],
   "source": [
    "import cv2 as cv\n",
    "import numpy as np\n",
    "\n",
    "img1 = cv.imread('../data/ml.png')\n",
    "img3 = cv.imread('../data/opencv-logo.png')\n",
    "\n",
    "if img1 is None or img3 is None:\n",
    "    print(\"[ERROR] fail to read Image!!!\")\n",
    "    exit(0)\n",
    "\n",
    "print(img1.shape, img3.shape)\n",
    "#resize函数改变图像大小\n",
    "img2 = cv.resize(img3, (img1.shape[1],img1.shape[0]))\n",
    "print(img2.shape)\n",
    "\n",
    "#两张图像需相同\n",
    "dst = cv.addWeighted(img1,0.7, img2,0.3, 0)\n",
    "cv.imshow('dst',dst)\n",
    "cv.waitKey(0)\n",
    "cv.destroyAllWindows()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
